home *** CD-ROM | disk | FTP | other *** search
- /*
- * Name.h - class definition for space efficient name storage.
- *
- * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
- * University of Berne, Switzerland
- * Portions Copyright (C) 1990, Jonathan P. Leech
- * All rights reserved.
- *
- * This software may be freely copied, modified, and redistributed
- * provided that this copyright notice is preserved on all copies.
- *
- * You may not distribute this software, in whole or in part, as part of
- * any commercial product without the express consent of the authors.
- *
- * There is no warranty or other guarantee of fitness of this software
- * for any purpose. It is provided solely "as is".
- *
- */
-
- #ifndef Name_H
- # define Name_H
-
- #include <iostream.h>
- #include "rcString.h"
- #include "list.h"
-
- //___________________________________________________________ Name
-
- typedef rcString* rcStringPtr;
- declareList(rcStringList, rcStringPtr);
-
- class Name
- {
- public:
- Name(const char*);
- Name(const rcString*);
- Name(const Name&);
-
- const Name& operator=(const Name&);
- int operator==(const Name&) const;
- operator const char*() const;
- long index() const;
-
- static long addname(const char*);
- static long namesCount();
- friend ostream& operator<<(ostream&, const Name&);
-
- private:
- static rcStringList* GlobalNameSpace;
- long index_;
- };
-
- typedef Name* NamePtr;
- declareList(NameList, NamePtr);
-
- inline Name::Name(const Name& aName)
- : index_(aName.index_)
- {}
-
- inline int Name::operator==(const Name& aName) const {
- return (index_ == aName.index_);
- }
-
- inline long Name::index() const {
- return index_;
- }
-
- inline long Name::namesCount() {
- return GlobalNameSpace->count();
- }
-
- #endif // Name_H
-
-
-